package com.docios.cookbook2.Dao;

import android.content.Context;
import android.widget.Toast;

import androidx.room.Room;

public class DatabaseImpl {
    public static AppDatabase db;
//实例化数据库比较耗资源，所以单例
    public static AppDatabase setInstance(Context context){
        if (db == null){
            db = Room.databaseBuilder(context,AppDatabase.class,
                    "chefbear.db").allowMainThreadQueries().build();
        }
        return db;
    }

}
